//
//  KZNetUser.swift
//  KZSwiftMoudel
//
//  Created by 朱凯 on 2018/5/9.
//  Copyright © 2018年 JooKey. All rights reserved.
//

import UIKit

class KZNetTest {
    // MARK: ------ 用户
    // 测试
    static func test(api: KZNetApi,
                     params: [String : Any],
                     success: @escaping ([KZModelBanner])->(),
                     failure: @escaping ((String)->()) = {print($0)}) {
        
        
        
        KZNetBaseRequest(api: KZNetApi.indexBanner, params: params) { result in
            
            print(result)
            
            switch result.tag {
            case .success:
                var list = [KZModelBanner]()
                let data = result.data as! [Dictionary<String, Any>]
                for dic in data {
                    
                    let model = try! KZModelBanner.model(from: dic)
                    list.append(model)
                }
                success(list)
            case .failure(let error):
                failure(error)
                print(error)
            
            }
        }
    }
}


